package com.sharemarking.wa.platform.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.sharemarking.wa.common.entity.OrgWaste;
import com.sharemarking.wa.platform.dto.waste.OrgWasteListDto;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

/**
 * @author dxy
 */
@Repository
public interface OrgWasteMapper extends BaseMapper<OrgWaste> {
    @Select("SELECT a.* FROM wa_org_waste a LEFT JOIN sys_org b ON a.org_id = b.id " +
            "WHERE b.member_id = #{memberId} ORDER BY create_date DESC LIMIT #{pageIndex},#{pageSize}")
    List<OrgWasteListDto> getOrgWasteList(Map map);

    @Select("SELECT COUNT(*) FROM wa_org_waste a LEFT JOIN sys_org b ON a.org_id = b.id " +
            "WHERE b.member_id = #{memberId}")
    Integer getOrgWasteTotal(Map map);

}
